<template>
  <div class="config-panel">
    <h4>{{ title }}</h4>
    <el-form label-position="top">
      <el-form-item label="占位符文本">
        <el-input v-model="config.placeholder" placeholder="例如：请输入关键词搜索" />
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  name: "SearchConfig",
  props: ['value', 'title'],
  computed: {
    config: {
      get() {
        if (!this.value.placeholder) this.$set(this.value, 'placeholder', '请输入关键词搜索');
        return this.value;
      },
      set(newValue) { this.$emit('input', newValue); }
    }
  }
}
</script>

<style scoped>
.config-panel {
  border: 1px solid #f0f0f0;
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 20px;
}
h4 {
  margin-top: 0;
  margin-bottom: 20px;
}
</style>
